package com.zhuang.chapter10.work06;

import java.util.Scanner;

public class LoginTest {

	public static void main(String[] args) {
		for (int i = 0; i < 3; i++) {
			Scanner sc = new Scanner(System.in);
			System.out.println("请输入用户名:");
			String name = sc.nextLine();
			System.out.println("请输入密码:");
			String pwd = sc.nextLine();
			if (name.equals("zk") && pwd.equals("123")) {
				System.out.println("登录成功!");
				break;
			} else {
				if (2 - i == 0) {
					System.out.println("账户锁定!");
					break;
				} else {
					System.out.println("输入错误!重新输入,你还有" + (2 - i) + "次机会");
				}
			}
		}
	}
}
